#!D:/CODE/python
# -*- coding: utf-8 -*-
# @Time : 2020/6/4 12:13
# @Author : Alexdong
# @Site : 
# @File : numpy1.py
# @Software: PyCharm
# Functional description:

import numpy as np
import random

a = np.arange(24)

b = a + 2  # 把a的每一个数都执行操作  广播机制

c = a / 0

print(c)  # nan 和inf
# nan  不是一个数字
# inf  无限 无穷

# 当两个矩阵计算时，会对应位置做操作
# numpy有广播原则

t1 = np.array([random.random() for i in range(10)])
print(t1)
print(t1.dtype)

t2 = np.round(t1, 2)
print(t2)


np.vstack(t1,t2)  # 竖直拼接
